package com.zd.wechatPlatform.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public abstract class BaseController {
	/**
	 * 日志对象
	 */
	protected Logger logger = Logger.getLogger(getClass());

	/**
	 * 得到request对象
	 */
	public HttpServletRequest getRequest() {
		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
				.getRequestAttributes()).getRequest();
		return request;
	}

	/**
	 * 得到response对象
	 */
	public HttpServletResponse getResponse() {
		HttpServletResponse resp = ((ServletRequestAttributes) RequestContextHolder
				.getRequestAttributes()).getResponse();
		return resp;
	}
}
